package com.jblog.core.service.facde.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jblog.core.model.account.Account;
import com.jblog.core.model.account.Log;
import com.jblog.core.model.account.param.AccountParam;
import com.jblog.core.model.account.param.LogParam;
import com.jblog.core.service.account.LogService;
import com.jblog.core.service.account.AccountService;
import com.jblog.core.service.facde.AccountFacade;

@Service
public class AccountFacadeImpl implements AccountFacade {

    /**** AccountService ****/
    @Autowired private AccountService accountService;

    @Override
    public void deleteAccount(Long id) {
        accountService.delete(id);
    }

    @Override
    public void enDisableAccount(Account e, boolean able) {
        accountService.enDisable(e, able);
    }

    @Override
    public Long findCountOfAccount(AccountParam p) {
        return accountService.count(p);
    }

    @Override
    public Account findAccountById(Long id) {
        return accountService.findById(id);
    }

    @Override
    public Account findAccountByName(String s) {
        return accountService.findByName(s);
    }

    @Override
    public Account findAccountByEmail(String s) {
        return accountService.findByEmail(s);
    }

    @Override
    public Account findAccountByActiveCode(String s) {
        return accountService.findByActiveCode(s);
    }

    @Override
    public List<Account> findAccountByParamByPage(AccountParam p) {
        return accountService.findByParam(p);
    }

    @Override
    public void saveAccount(Account e) {
        accountService.save(e);
    }

    @Override
    public void updateAccount(Account e) {
        accountService.update(e);
    }
    
    /**** AccountLogService ****/
    
    @Autowired private LogService logService;
    
    @Override
    public List<Log> findLogByParam(LogParam p) {
        return logService.findByParam(p);
    }

    @Override
    public Long findCountOfLog(LogParam p) {
        return logService.count(p);
    }

    @Override
    public void saveLog(Log e) {
        logService.save(e);
    }

    @Override
    public void deleteLog(Long id) {
        logService.delete(id);
    }

    @Override
    public void deleteLog(List<Long> ids) {
        logService.delete(ids);
    }
    
}
